Skip to content

Add Link support to rich_text widget#2512

Merged
hecrj merged 5 commits intomasterfrom
feature/rich-text-links
Jul 21, 2024
Merged

Add Link support to rich_text widget#2512
hecrj merged 5 commits intomasterfrom
feature/rich-text-links

Conversation

@hecrj
Copy link
Member

@hecrj hecrj commented Jul 21, 2024

This PR introduces hyperlink support to the rich_text and span widgets.

The link type is generic; so you do not necessarily need to rely on strings for your links:

enum Message {
    LinkClicked(Link)
}

enum Link {
    Rust,
    Iced,
}

rich_text![
    "Here are 2 links: ",
    span("Rust").link(Link::Rust),
    " and ",
    span("Iced").link(Link::Iced)
]
.on_link(Message::LinkClicked)

The markdown widget does use strings as links, for obvious reasons.

@hecrj hecrj added feature New feature or request text widget addition labels Jul 21, 2024
@hecrj hecrj added this to the 0.13 milestone Jul 21, 2024
@hecrj hecrj force-pushed the feature/rich-text-links branch from e1dafd4 to 78c4f7e Compare July 21, 2024 12:01
Copy link
Member

@tarkah tarkah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@hecrj hecrj merged commit 5443e4d into master Jul 21, 2024
@hecrj hecrj deleted the feature/rich-text-links branch July 21, 2024 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments